
minetest.register_craftitem("lunorecipes:water", {
	description = "Agua Potavel",
	inventory_image = "water.png",
	stack_max=16, --Acumula 16 por slot
	groups = { eat=1 },
})

minetest.register_craftitem("lunorecipes:salt", {
	description = "Sal de Cozinha",
	inventory_image = "salt.png",
	groups = { eat=1 },
})

minetest.register_node("lunorecipes:glass_cup", {
	description = "Copo de vidro",
	drawtype = "plantlike",
	tiles = {"glass_cup.png"},
	inventory_image = "glass_cup.png",
	wield_image = "glass_cup.png",
	paramtype = "light",
	liquids_pointable = true, -- Pode apontar para node de Liquidos (mais tarde podera coletar agua)
	stack_max=99, --Acumula 6 por slot
	walkable = false,
	selection_box = {
		type = "fixed",
		fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
	},
	--groups = {vessel=1,dig_immediate=3,attached_node=1},
	groups = {vessel=1,dig_immediate=3,attached_node=1},
	sounds = default.node_sound_glass_defaults(),
	after_place_node = function(pos, placer)
		local meta = minetest.get_meta(pos)
		--meta:set_string("owner", placer:get_player_name() or "")
		meta:set_string("infotext", "Copo de vidro")
	end,
	on_use = function(itemstack, user, pointed_thing)
		if pointed_thing.under~=nil then
			local node = minetest.get_node(pointed_thing.under)
			--minetest.chat_send_player(user:get_player_name(), "Voce esta apontando para '".. node.name .."'!")
			if node.name == "default:water_source" or node.name == "default:water_flowing" then
				--minetest.sound_play("sfx_water", {pos=user.pos, max_hear_distance = 5}) --toca som "sfx_water".ogg a distancia de 5 blocos do usuario.
				minetest.sound_play("sfx_water", {to_player=user:get_player_name(), max_hear_distance = 5}) --toca som "sfx_water".ogg a distancia de 5 blocos do usuario.
				user:get_inventory():add_item("main", ItemStack("lunorecipes:water"))
			else
				minetest.chat_send_player(user:get_player_name(), "Voce nao pode coletar isto com este item.")
			end
			return
		end
	end,
	
})

minetest.register_craft({
	output = "lunorecipes:glass_cup",
	recipe = {
		{"default:glass"},
		{"default:glass"},
	},
})

minetest.register_craft({
	type = "cooking",
	output = "lunorecipes:salt",
	recipe = "lunorecipes:water",
	cooktime = 5,
})
